package com.poc.dto;


public class ResponseResult<T> {
    private Integer code;
    private String message;
    private T result;

    private ResponseResult(ResultCode resultCode, T result) {
        this.code = resultCode.code();
        this.message = resultCode.message();
        this.result = result;
    }

    public static <T> ResponseResult<T> success(T result) {
        return new ResponseResult<>(ResultCode.SUCCESS, result);
    }


    public static <T> ResponseResult<T> failure(T result) {
        return new ResponseResult<>(ResultCode.INTERNAL_SERVER_ERROR, result);
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getResult() {
        return result;
    }

    public void setResult(T result) {
        this.result = result;
    }
}